package com.example.demo.controller;

import com.example.demo.entity.CommonResult;
import com.example.demo.service.StockMangeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StockMangeController {

    @Autowired
    StockMangeService stockMangeService;

    @ResponseBody
    @GetMapping("/stock/selectStock")
    @ApiOperation(notes = "根据库存范围和id查询", value = "selectStock")
    public CommonResult selectStock(String drug_id,Integer amount) {
        if (drug_id==null && amount==null){
            return new CommonResult(401,"不能空参查询");
        }
        CommonResult selectsalegoods = stockMangeService.selectStock(drug_id, amount);
        return selectsalegoods;
    }
}
